@(afangar: List[models.general.vKennariHoparOnn], tilkynningar: List[models.domain.Announcements], top5tilkynningar: List[models.domain.Announcements],
afangiID : Integer, students : List[models.domain.Students], projects : List[models.domain.Project], hopurID : Integer, baekur: List[models.domain.Baekur])

@teacherMain(title = "Áfangarnir mínir") {

    <div class="container conLower">
        <div class ="row">
            <div class ="span12">
                <div class ="tabbable">
                    <ul class="nav nav-tabs">
                        @for((afangi, i) <- afangar.zipWithIndex) {
                            @if(afangiID != 0 && hopurID != 0){
                                @if(afangi.getAfangi_id == afangiID && afangi.getHopur_id == hopurID){
                                    <li class ="active dashStaerri"> <a href ="#tab@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab"> @{afangi.getNamsgrein_afanganr} - @{afangi.getHopur}</a> </li>
                                }else {
                                    <li> <a href ="#tab@{afangi.getAfangi_id+afangi.getHopur_id}" class = "dashStaerri" data-toggle="tab" > @{afangi.getNamsgrein_afanganr} - @{afangi.getHopur}</a> </li>
                                }

                            }else{
                                @if(i == 0) {
                                    <li class ="active dashStaerri"> <a href ="#tab@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab"> @{afangi.getNamsgrein_afanganr} - @{afangi.getHopur}</a> </li>
                                } else {
                                    <li> <a href ="#tab@{afangi.getAfangi_id+afangi.getHopur_id}" class = "dashStaerri" data-toggle="tab" > @{afangi.getNamsgrein_afanganr} - @{afangi.getHopur}</a> </li>
                                }
                            }
                        }
                    </ul>
                    <div class="tab-content">
                        @for((afangi,j) <- afangar.zipWithIndex){
                            @if(j == 0){
                                <div class="tab-pane active" id="tab@{afangi.getAfangi_id+afangi.getHopur_id}">
                                    }else{
                                <div class="tab-pane" id="tab@{afangi.getAfangi_id+afangi.getHopur_id}">
                                    }
                                <div class ="tabbable tabs-right">
                                    <ul class="nav nav-tabs">
                                        <li class =" active dashStaerri"> <a href ="#tab1@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab"> Upphafssíða </a> </li>
                                        <li> <a href ="#tab2@{afangi.getAfangi_id+afangi.getHopur_id}"  class = "dashStaerri" data-toggle="tab"> Bókalisti </a> </li>
                                        <li> <a href ="#tab3@{afangi.getAfangi_id+afangi.getHopur_id}"  class = "dashStaerri" data-toggle="tab"> Tilkynningar </a> </li>
                                        <li> <a href ="#tab4@{afangi.getAfangi_id+afangi.getHopur_id}"  class = "dashStaerri" data-toggle="tab"> Nemendalisti </a> </li>
                                        <li> <a href ="#tab5@{afangi.getAfangi_id+afangi.getHopur_id}"  class = "dashStaerri" data-toggle="tab"> Verkefni </a> </li>
                                        <li> <a href ="#tab6@{afangi.getAfangi_id+afangi.getHopur_id}"  class = "dashStaerri" data-toggle="tab" > Próf </a> </li>
                                    </ul>




                                    <div class="tab-content">
                                            <!--Upphafssíða -->
                                        <div class="tab-pane active" id="tab1@{afangi.getAfangi_id+afangi.getHopur_id}" >
                                            <div class="row">
                                            <div class="span4">
                                            <div>
                                            <ul class ="nav nav-tabs">
                                            <li ><a class = "dashStaerri">Næstu skil</a> </li>
                                            </ul>
                                            </div>
                                            <table class = "table table-striped">
                                            <tr>
                                            <th>Heiti</th>
                                            <th>Tegund</th>
                                            <th>Skiladagur</th>
                                            </tr>
                                                @for(project <- projects){
                                                    @if(project.getAfangi_id == afangi.getAfangi_id){
                                                        @if(project.getOpenProjects != null){
                                                            @for(proj <- project.getOpenProjects){
                                                                @if(proj.getHandedIn == true){
                                                                    <tr>
                                                                        <td><a href="@{routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id, project.getHopur_id)}" style="color:black;"/>@{proj.getName}</td>
                                                                        @if(proj.getType=="prof"){
                                                                            <td>Próf</td>
                                                                        }
                                                                        @if(proj.getType=="verkefni"){
                                                                            <td>Verkefni</td>
                                                                        }
                                                                        <td id="d@proj.getVerkefni_id()">@{proj.getHandInDate}</td>
                                                                    </tr>
                                                                }else{
                                                                    <tr id="d@proj.getVerkefni_id()">
                                                                        <td><a href="@routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id, project.getHopur_id)" style="color:black;"/>@{proj.getName}</td>
                                                                        @if(proj.getType=="prof"){
                                                                            <td>Próf</td>
                                                                        }
                                                                        @if(proj.getType=="verkefni"){
                                                                            <td>Verkefni</td>
                                                                        }
                                                                        <td >@{proj.getHandInDate}</td>

                                                                    </tr>

                                                                }
                                                            }
                                                        }

                                                    }

                                                }
                                            </table>
                                            </div>
                                                <div class="span6">
                                                    <div>
                                                        <ul class ="nav nav-tabs">
                                                            <li ><a class = "dashStaerri">Tilkynningar</a></li>
                                                        <li> <a href="#modal@afangi.getAfangi_id" data-toggle="modal" title="Bæta við tilkynningu"><i class="icon icon-plus"></i></a></li>
                                                        </ul>
                                                    </div>
                                                <div>
                                                    @for(top5 <- top5tilkynningar){
                                                       @if(top5.getAfangi_id_Int == afangi.getAfangi_id && top5.getHopur_id == afangi.getHopur_id){
                                                            @if(top5.getTilkynningar != null){
                                                                @for(top5til <- top5.getTilkynningar){
                                                                    <div class="well">
                                                                    <p style="font-size:15px; font-weight: bold;"> @{top5til.getDagur_stofnad} &nbsp &nbsp @{top5til.getFyrirsogn}</p>
                                                                    <p>@{top5til.getTexti}</p>
                                                                    </div>
                                                                }
                                                            }
                                                        }
                                                    }
                                                </div>
                                                </div>
                                            </div>
                                        </div>
                                            <!--Lýsing -->
                                        <div class="tab-pane" id="tab2@{afangi.getAfangi_id+afangi.getHopur_id}">
                                            <h3>Bókalisti fyrir @{afangi.getNamsgrein_afanganr}</h3>
                                                @for(bok <- baekur){
                                                    @if(bok.getAfangi_id == afangi.getAfangi_id){
                                                        @if(bok.getHeitiHofundur != null){
                                                            <table class="table table-striped">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Heiti</th>
                                                                        <th> Höfundur</th>
                                                                        <th> Útgáfa </th>
                                                                        <th> Útgefandi </th>
                                                                    <tr>
                                                                </thead>
                                                                <tbody>
                                                                    @for(bokHeiti <- bok.getHeitiHofundur){
                                                                        <tr>
                                                                        <td>@{bokHeiti.getHeiti}</td>
                                                                        <td>@{bokHeiti.getHofundur}</td>
                                                                        <td>@{bokHeiti.getUtgafa}</td>
                                                                        <td>@{bokHeiti.getUtgefandi}</td>
                                                                        </tr>
                                                                    }
                                                                </tbody>
                                                            </table>
                                                        }
                                                    }
                                                }
                                        </div>
                                            <!--Tilkynningar -->
                                        <div class="tab-pane" id="tab3@{afangi.getAfangi_id+afangi.getHopur_id}">
                                            <div class="row">
                                                <div class="span10">
                                                <div class="tabbable">
                                                    <ul class ="nav nav-tabs">
                                                         <li ><a class = "dashStaerri">Tilkynningar</a> </li>
                                                    <p style="text-align:right"><a href="#modal@afangi.getAfangi_id" class="btn btn-primary" data-toggle="modal"><i class="icon-white icon-edit"></i> Búa til nýja tilkynningu </a> </p>
                                                    </ul>
                                                </div>
                                                <div>
                                                    @for(tilkynning <- tilkynningar){
                                                        @if(tilkynning.getAfangi_id_Int == afangi.getAfangi_id){
                                                            @if(tilkynning.getTilkynningar != null){
                                                                @for(til <- tilkynning.getTilkynningar){
                                                                    <div class="well">
                                                                    <p style="font-size:15px; font-weight: bold;"> @{til.getDagur_stofnad} &nbsp &nbsp @{til.getFyrirsogn}</p>
                                                                    <p>@{til.getTexti}</p>
                                                                    </div>
                                                                }
                                                            }
                                                        }
                                                    }
                                                </div>
                                                </div>
                                            </div>
                                        </div>


                                        <!--Modal -->
                                    <div id="modal@afangi.getAfangi_id" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                    <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h3 id="myModalLabel">Setja inn nýja tilkynningu</h3>
                                    </div>
                                        @helper.form(action = routes.TeacherController.uploadAnnouncements(2)){
                                            <div class="modal-body">
                                                <imput type="hidden" class="input-xlarge" name="afangi_id" value="@afangi.getAfangi_id"/>
                                                <div class="control-group">
                                                    <div class="controls">
                                                            <input type="hidden" value="@afangi.getAfangi_id" name="afangi_id"/>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label"> Fyrirsögn </label>
                                                    <div class="controls">
                                                        <input class="input-xlarge" name="fyrirsogn">
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label class="control-label"> Tilkynning </label>
                                                    <div class="controls">
                                                        <textarea class="input-xxlarge" name="texti"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="submit" class="btn btn-primary" value="submit">Vista tilkynningu</button>
                                                <button class="btn" data-dismiss="modal" aria-hidden="true">Hætta við</button>
                                            </div>
                                        }
                                    </div>
                                        <!--End of modal-->


                                            <!--Nemendalisti -->
                                        <div class="tab-pane" id="tab4@{afangi.getAfangi_id+afangi.getHopur_id}">
                                            <div class="row">
                                                <div class="span1">
                                                </div>
                                                <div class="span8">
                                                    <table class="table table-striped">
                                                    <tr>
                                                    <th>Nafn</th>
                                                    <th>Kennitala</th>
                                                    <th>Hópur</th>
                                                    </tr>
                                                        @for(student <- students){
                                                            @if(student.getAfangi_id == afangi.getAfangi_id && student.getHopur_id == afangi.getHopur_id){

                                                                @for(s <- student.getStudents){
                                                                    <tr>
                                                                    <td>@{s.getName}</td>
                                                                    <td>@{s.getKennitala}</td>
                                                                    <td>@{s.getHopur}</td>
                                                                    </tr>
                                                                }
                                                            }

                                                        }

                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                            <!--Verkefni -->
                                        <div class="tab-pane" id="tab5@{afangi.getAfangi_id+afangi.getHopur_id}">
                                            <div class="row">
                                                <div class="span10">
                                                <h3>Öll Verkefni</h3>

                                                <div class="tabbable">
                                                    <ul class="nav nav-tabs">
                                                        <li class ="active"><a href ="#opid1@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab">Opin Verkefni</a> </li>
                                                        <li><a href ="#lokad1@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab">Lokuð Verkefni</a> </li>
                                                    </ul>
                                                    <div class = "tab-content">
                                                    <div class = "tab-pane active" id ="opid1@{afangi.getAfangi_id+afangi.getHopur_id}">
                                                        <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                            <thead>
                                                                <tr>
                                                                    <th>Verkefni</th>
                                                                    <th>Lagt fyrir</th>
                                                                    <th>Skilafrestur</th>
                                                                    <th>Vægi</th>
                                                                </tr>
                                                            </thead>

                                                            <tbody>
                                                                @for(project <- projects){
                                                                    @if(afangi.getAfangi_id == project.getAfangi_id && afangi.getHopur_id == project.getHopur_id ){
                                                                        @if(project.getOpenProjects != null){
                                                                            @for(proj <- project.getOpenProjects){
                                                                                @if(proj.getType == "verkefni"){
                                                                                    <tr>
                                                                                        <td><a href="@{routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id,project.getHopur_id)}" style="color:black;"/>@proj.getName</td>
                                                                                        <td>@proj.getbeginDate()</td>
                                                                                        <td>@proj.getHandInDate</td>
                                                                                        <td>@(proj.getWeight)%</td>
                                                                                    </tr>
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            </tbody>

                                                        </table>
                                                    </div>

                                                    <div class="tab-pane" id="lokad1@{afangi.getAfangi_id+afangi.getHopur_id}">

                                                        <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                            <thead>
                                                                <tr>
                                                                    <th>Verkefni</th>
                                                                    <th>Lagt fyrir</th>
                                                                    <th>Skilafrestur</th>
                                                                    <th>Vægi</th>
                                                                </tr>
                                                            </thead>

                                                            <tbody>
                                                                @for(project <- projects){
                                                                    @if(afangi.getAfangi_id == project.getAfangi_id && afangi.getHopur_id == project.getHopur_id){
                                                                        @if(project.getClosedProjects != null){
                                                                            @for(proj <- project.getClosedProjects){
                                                                                @if(proj.getType == "verkefni"){
                                                                                    <tr>
                                                                                        <td><a href="@{routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id,project.getHopur_id)}" style="color:black;"/>@proj.getName</td>
                                                                                        <td>@proj.getbeginDate()</td>
                                                                                        <td>@proj.getHandInDate</td>
                                                                                        <td>@(proj.getWeight)%</td>
                                                                                    </tr>
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                    </div>
                                                </div>


                                                </div>
                                            </div>
                                        </div>
                                            <!--Próf -->
                                        <div class="tab-pane" id="tab6@{afangi.getAfangi_id+afangi.getHopur_id}">
                                            <div class="row">
                                                <div class="span10">
                                                    <h3>Öll Próf</h3>

                                                    <div class="tabbable">
                                                        <ul class="nav nav-tabs">
                                                            <li class ="active"><a href ="#opid2@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab">Opin Próf</a> </li>
                                                            <li><a href ="#lokad2@{afangi.getAfangi_id+afangi.getHopur_id}" data-toggle="tab">Lokuð Próf</a> </li>
                                                        </ul>
                                                    <div class = "tab-content">
                                                        <div class = "tab-pane active" id ="opid2@{afangi.getAfangi_id+afangi.getHopur_id}">
                                                            <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Verkefni</th>
                                                                        <th>Lagt fyrir</th>
                                                                        <th>Skilafrestur</th>
                                                                        <th>Vægi</th>
                                                                    </tr>
                                                                </thead>

                                                                <tbody>
                                                                    @for(project <- projects){
                                                                        @if(afangi.getAfangi_id == project.getAfangi_id && afangi.getHopur_id == project.getHopur_id ){
                                                                            @if(project.getOpenProjects != null){
                                                                                @for(proj <- project.getOpenProjects){
                                                                                    @if(proj.getType == "prof"){
                                                                                        <tr>
                                                                                            <td><a href="@{routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id,project.getHopur_id)}" style="color:black;"/>@proj.getName</td>
                                                                                            <td>@proj.getbeginDate()</td>
                                                                                            <td>@proj.getHandInDate</td>
                                                                                            <td>@(proj.getWeight)%</td>
                                                                                        </tr>
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                </tbody>

                                                            </table>
                                                        </div>

                                                        <div class="tab-pane" id="lokad2@{afangi.getAfangi_id+afangi.getHopur_id}">

                                                            <table class="table table-striped" cellpadding="0" cellspacing="0" border="0" class="display">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Verkefni</th>
                                                                        <th>Lagt fyrir</th>
                                                                        <th>Skilafrestur</th>
                                                                        <th>Vægi</th>
                                                                    </tr>
                                                                </thead>

                                                                <tbody>
                                                                    @for(project <- projects){
                                                                        @if(afangi.getAfangi_id == project.getAfangi_id && afangi.getHopur_id == project.getHopur_id){
                                                                            @if(project.getClosedProjects != null){
                                                                                @for(proj <- project.getClosedProjects){
                                                                                    @if(proj.getType == "prof"){
                                                                                        <tr>
                                                                                            <td><a href="@{routes.TeacherController.teacherOneAssignment(proj.getVerkefni_id,project.getHopur_id)}" style="color:black;"/>@proj.getName</td>
                                                                                            <td>@proj.getbeginDate()</td>
                                                                                            <td>@proj.getHandInDate</td>
                                                                                            <td>@(proj.getWeight)%</td>
                                                                                        </tr>
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                    </div>


                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                        </div>
                        }
                    </div>
                    </div>


                </div>
            </div>
        </div>
    </div> <!-- end of container conLower -->
}
